home *** CD-ROM | disk | FTP | other *** search
/ The Hacker Chronicles - A…the Computer Underground / The Hacker Chronicles - A Tour of the Computer Underground (P-80 Systems).iso / network / nia22 < prev    next >
Text File  |  1992-09-26  |  43KB  |  1,057 lines

  1.  ZDDDDDDDDDDDDDDDDDD? IMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM; ZDDDDDDDDDDDDDDDDDD?
  2.  3   Founded By:    3 :  Network Information Access   : 3   Founded By:    3
  3.  3 Guardian Of Time CD6            17APR90            GD4   Judge Dredd    3
  4.  @DDDDDDDDBDDDDDDDDDY :          Judge Dredd          : @DDDDDDDDDBDDDDDDDDY
  5.           3           :            File 22            :           3
  6.           3           HMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM<           3
  7.           3        IMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM;      3
  8.           @DDDDDDDD6 Frequently Asked Questions About UNIX GDDDDDDY
  9.                    HMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM<
  10.  
  11. This article contains the answers to some Frequently Asked Questions about
  12. UNIX.
  13. This article includes answers to:
  14.  
  15.  
  16.         1)  How do I remove a file whose name begins with a "-" ?
  17.         2)  How do I remove a file with funny characters in the filename ?
  18.         3)  How do I get a recursive directory listing?
  19.         4)  How do I get the current directory into my prompt?
  20.         5)  How do I read characters from a terminal without requiring the user
  21.               to hit RETURN?
  22.         6)  How do I read characters from the terminal in a shell script?
  23.         7)  How do I check to see if there are characters to be read without
  24.               actually reading?
  25.         8)  How do I find the name of an open file?
  26.         9)  How do I rename "*.foo" to "*.bar", or change file names
  27.               to lowercase?
  28.         10) Why do I get [some strange error message] when I
  29.               "rsh host command" ?
  30.         11) How do I find out the creation time of a file?
  31.         12) How do I use "rsh" without having the rsh hang around
  32.               until the remote command has completed?
  33.         13) How do I truncate a file?
  34.         14) How do I ñset an environment variable, change directoryç inside a
  35.               shell script and have that change affect my current shell?
  36.         15) Why doesn't find's "ñç" symbol do what I want?
  37.         16) How do I redirect stdout and stderr separately in csh?
  38.         17) How do I set the permissions on a symbolic link?
  39.         18) When someone refers to 'rn(1)' or 'ctime(3)', what does
  40.               the number in parentheses mean?
  41.         19) What does ñawk,grep,fgrep,egrep,biff,cat,gecos,nroff,troff,tee,bssç
  42.               stand for?
  43.         20) How does the gateway between "comp.unix.questions" and the
  44.             "info-unix" mailing list work?
  45.         21) How do I pronounce "vi" , or "!", or "/*", or ...?
  46.  
  47.  
  48.     If you're looking for the answer to, say, question 14, and want to skip
  49.     everything else, you can search ahead for the regular expression "^14)".
  50.  
  51. While these are all legitimate questions, they seem to crop up in
  52. comp.unix.questions on an annual basis, usually followed by plenty
  53. of replies (only some of which are correct) and then a period of
  54. griping about how the same questions keep coming up.  You may also like
  55. to read the monthly article "Answers to Frequently Asked Questions"
  56. in the newsgroup "news.announce.newusers", which will tell you what
  57. "UNIX" stands for.
  58.  
  59. With the variety of Unix systems in the world, it's hard to guarantee
  60. that these answers will work everywhere.  Read your local manual pages
  61. before trying anything suggested here.  If you have suggestions or
  62. corrections for any of these answers, please send them to to
  63. sahayman@iuvax.cs.indiana.edu or iuvax!sahayman.
  64.  
  65. 1)  How do I remove a file whose name begins with a "-" ?
  66.  
  67.     Figure out some way to name the file so that it doesn't
  68.     begin with a dash.  The simplest answer is to use
  69.  
  70.             rm ./-filename
  71.  
  72.     (assuming "-filename" is in the current directory, of course.)
  73.     This method of avoiding the interpretation of the "-" works
  74.     with other commands too.
  75.  
  76.     Many commands, particularly those that have been written to use
  77.     the "getopt(3)" argument parsing routine, accept a "--" argument
  78.     which means "this is the last option, anything after this is not
  79.     an option", so your version of rm might handle "rm -- -filename".
  80.     Some versions of rm that don't use getopt() treat a single "-"
  81.     in the same way, so you can also try "rm - -filename".
  82.  
  83. 2)  How do I remove a file with funny characters in the filename ?
  84.  
  85.     The  classic answers are
  86.  
  87.         rm -i some*pattern*that*matches*only*the*file*you*want
  88.  
  89.         which asks you whether you want to remove each file matching
  90.         the indicated pattern;  depending on your shell, this may
  91.         not work if the filename has a character with the 8th bit set
  92.         (the shell may strip that off);
  93.  
  94.     and
  95.  
  96.         rm -ri .
  97.  
  98.         which asks you whether to remove each file in the directory,
  99.         answer "y" to the problem file and "n" to everything else.,
  100.         and which, unfortunately, doesn't work with many versions of rm;
  101.         (always take a deep breath and think about what you're doing
  102.         and double check what you typed when you use rm's "-r" flag)
  103.  
  104.     and
  105.  
  106.         find . -type f ... -ok rm 'ñç' ╪;
  107.  
  108.     where "..." is a group of predicates that uniquely identify the
  109.     file.  One possibility is to figure out the inode number
  110.     of the problem file (use "ls -i .") and then use
  111.  
  112.         find . -inum 12345 -ok rm 'ñç' ╪;
  113.  
  114.     or
  115.         find . -inum 12345 -ok mv 'ñç' new-file-name ╪;
  116.  
  117.  
  118.     "-ok" is a safety check - it will prompt you for confirmation of the
  119.     command it's about to execute.  You can use "-exec" instead to avoid
  120.     the prompting, if you want to live dangerously, or if you suspect
  121.     that the filename may contain a funny character sequence that will mess
  122.     up your screen when printed.
  123.  
  124.     If none of these work, find your system manager.
  125.  
  126. 3)  How do I get a recursive directory listing?
  127.  
  128.     One of the following may do what you want:
  129.  
  130.         ls -R                         (not all versions of "ls" have -R)
  131.         find . -print                (should work everywhere)
  132.         du -a .                        (shows you both the name and size)
  133.  
  134.     If you're looking for a wildcard pattern that will match
  135.     all ".c" files in this directory and below, you won't find one,
  136.     but you can use
  137.  
  138.         % some-command ¢find . -name '*.c' -print¢
  139.  
  140.     "find" is a powerful program.  Learn about it.
  141.  
  142. 4)  How do I get the current directory into my prompt?
  143.  
  144.     It depends which shell you are using.  It's easy with some shells,
  145.     hard or impossible with others.
  146.  
  147.     C Shell (csh):
  148.         Put this in your .cshrc - customize the prompt variable
  149.         the way you want.
  150.  
  151.             alias setprompt 'set prompt="$ñcwdç% "'
  152.             setprompt                # to set the initial prompt
  153.             alias cd 'chdir ╪!* && setprompt'
  154.  
  155.         If you use pushd and popd, you'll also need
  156.  
  157.             alias pushd 'pushd ╪!* && setprompt'
  158.             alias popd  'popd  ╪!* && setprompt'
  159.  
  160.         Some C shells don't keep a $cwd variable - you can use
  161.         ¢pwd¢ instead.
  162.  
  163.         If you just want the last component of the current directory
  164.         in your prompt ("mail% " instead of "/usr/spool/mail% ")
  165.         you can use
  166.  
  167.             alias setprompt 'set prompt="$cwd:t% "'
  168.  
  169.  
  170.         Some older csh's get the meaning of && and || reversed.
  171.         Try doing:
  172.  
  173.             false && echo bug
  174.  
  175.         If it prints "bug", you need to switch && and || (and get
  176.         a better version of csh.)
  177.  
  178.  
  179.     Bourne Shell (sh):
  180.  
  181.         If you have a newer version of the Bourne Shell (SVR2 or newer)
  182.         you can use a shell function to make your own command, "xcd" say:
  183.  
  184.             xcd() ñ cd $* ; PS1="¢pwd¢ $ "; ç
  185.  
  186.         If you have an older Bourne shell, it's complicated but not impossible.
  187.         Here's one way.  Add this to your .profile file:
  188.  
  189.                 LOGIN_SHELL=$$ export LOGIN_SHELL
  190.                 CMDFILE=/tmp/cd.$$ export CMDFILE
  191.                 PROMPTSIG=16 export PROMPTSIG
  192.                 trap '. $CMDFILE' $PROMPTSIG
  193.  
  194.         and then put this executable script (without the indentation!),
  195.         let's call it "xcd", somewhere in your PATH
  196.  
  197.                 : xcd directory - change directory and set prompt
  198.                 : by signalling the login shell to read a command file
  199.                 cat >$ñCMDFILE?"not set"ç <<EOF
  200.                 cd $1
  201.                 PS1="╪¢pwd╪¢$ "
  202.                 EOF
  203.                 kill -$ñPROMPTSIG?"not set"ç $ñLOGIN_SHELL?"not set"ç
  204.  
  205.         Now change directories with "xcd /some/dir".
  206.  
  207.  
  208.     Korn Shell (ksh):
  209.  
  210.         Put this in your .profile file:
  211.                 PS1='$PWD $ '
  212.  
  213.         If you just want the last component of the directory, use
  214.                 PS1='$ñPWD##*/ç $ '
  215.  
  216.  
  217. 5)  How do I read characters from a terminal without requiring the user
  218.     to hit RETURN?
  219.  
  220.     Check out cbreak mode in BSD, ─ICANON mode in SysV.
  221.  
  222.     If you don't want to tackle setting the terminal parameters
  223.     yourself (using the "ioctl(2)" system call) you can let the stty
  224.     program do the work - but this is slow and inefficient, and you
  225.     should change the code to do it right some time:
  226.  
  227.     main()
  228.     ñ
  229.             int c;
  230.  
  231.             printf("Hit any character to continue╪n");
  232.             /*
  233.              * ioctl() would be better here; only lazy
  234.              * programmers do it this way:
  235.              */
  236.             system("/bin/stty cbreak");
  237.             c = getchar();
  238.             system("/bin/stty -cbreak");
  239.             printf("Thank you for typing %c.╪n", c);
  240.  
  241.             exit(0);
  242.     ç
  243.  
  244.     You might like to check out the documentation for the "curses"
  245.     library of portable screen functions.  Often if you're interested
  246.     in single-character I/O like this, you're also interested in doing
  247.     some sort of screen display control, and the curses library
  248.     provides various portable routines for both functions.
  249.  
  250.  
  251.  
  252. 6)  How do I read characters from the terminal in a shell script?
  253.  
  254.     In sh, use read.  It is most common to use a loop like
  255.  
  256.             while read line
  257.             do
  258.                     ...
  259.             done
  260.  
  261.     In csh, use $< like this:
  262.  
  263.             while ( 1 )
  264.                 set line = "$<"
  265.                 if ( "$line" == "" ) break
  266.                 ...
  267.             end
  268.  
  269.     Unfortunately csh has no way of distinguishing between
  270.     a blank line and an end-of-file.
  271.  
  272.     If you're using sh and want to read a *single* character from
  273.     the terminal, you can try something like
  274.  
  275.             echo -n "Enter a character: "
  276.             stty cbreak
  277.             readchar=¢dd if=/dev/tty bs=1 count=1 2>/dev/null¢
  278.             stty -cbreak
  279.  
  280.             echo "Thank you for typing a $readchar ."
  281.  
  282. 7)  How do I check to see if there are characters to be read without
  283.     actually reading?
  284.  
  285.     Certain versions of UNIX provide ways to check whether
  286.     characters are currently available to be read from a file
  287.     descriptor.  In BSD, you can use select(2).  You can also use
  288.     the FIONREAD ioctl (see tty(4)), which returns the number of
  289.     characters waiting to be read, but only works on terminals,
  290.     pipes and sockets.  In System V Release 3, you can use poll(2),
  291.     but that only works on streams.  In Xenix - and therefore
  292.     Unix SysV r3.2 and later - the rdchk() system call reports
  293.     whether a read() call on a given file descriptor will block.
  294.  
  295.     There is no way to check whether characters are available to be
  296.     read from a FILE pointer.  (Well, there is no *good* way.  You could
  297.     poke around inside stdio data structures to see if the input buffer
  298.     is nonempty but this is a bad idea, forget about it.)
  299.  
  300.     Sometimes people ask this question with the intention of writing
  301.             if (characters available from fd)
  302.                     read(fd, buf, sizeof buf);
  303.     in order to get the effect of a nonblocking read.  This is not the
  304.     best way to do this, because it is possible that characters will
  305.     be available when you test for availability, but will no longer
  306.     be available when you call read.  Instead, set the O_NDELAY flag
  307.     (which is also called FNDELAY under BSD) using the F_SETFL option
  308.     of fcntl(2).  Older systems (Version 7, 4.1 BSD) don't have O_NDELAY;
  309.     on these systems the closest you can get to a nonblocking read is
  310.     to use alarm(2) to time out the read.
  311.  
  312.  
  313. 8)  How do I find the name of an open file?
  314.  
  315.     In general, this is too difficult.  The file descriptor may
  316.     be attached to a pipe or pty, in which case it has no name.
  317.     It may be attached to a file that has been removed.  It may
  318.     have multiple names, due to either hard or symbolic links.
  319.  
  320.     If you really need to do this, and be sure you think long
  321.     and hard about it and have decided that you have no choice,
  322.     you can use find with the -inum and possibly -xdev option,
  323.     or you can use ncheck, or you can recreate the functionality
  324.     of one of these within your program.  Just realize that
  325.     searching a 600 megabyte filesystem for a file that may not
  326.     even exist is going to take some time.
  327.  
  328.  
  329. 9) How do I rename "*.foo" to "*.bar", or change file names to lowercase?
  330.  
  331.     Why doesn't "mv *.foo *.bar" work?  Think about how the shell
  332.     expands wildcards.   "*.foo" "*.bar" are expanded before the mv
  333.     command ever sees the arguments.  Depending on your shell, this
  334.     can fail in a couple of ways.  CSH prints "No match." because
  335.     it can't match "*.bar".  SH executes "mv a.foo b.foo c.foo *.bar",
  336.     which will only succeed if you happen to have a single
  337.     directory named "*.bar", which is very unlikely and almost
  338.     certainly not what you had in mind.
  339.  
  340.     Depending on your shell, you can do it with a loop to "mv" each
  341.     file individually.  If your system has "basename", you can use:
  342.  
  343.     C Shell:
  344.         foreach f ( *.foo )
  345.             set base=¢basename $f .foo¢
  346.             mv $f $base.bar
  347.         end
  348.  
  349.     Bourne Shell:
  350.         for f in *.foo; do
  351.             base=¢basename $f .foo¢
  352.             mv $f $base.bar
  353.         done
  354.  
  355.     Some shells have their own variable substitution features, so instead
  356.     of using "basename", you can use simpler loops like:
  357.  
  358.     C Shell:
  359.  
  360.         foreach f ( *.foo )
  361.             mv $f $f:r.bar
  362.         end
  363.  
  364.     Korn Shell:
  365.  
  366.         for f in *.foo; do
  367.             mv $f $ñf%fooçbar
  368.         done
  369.  
  370.     If you don't have "basename" or want to do something like
  371.     renaming foo.* to bar.*, you can use something like "sed" to
  372.     strip apart the original file name in other ways, but
  373.     the general looping idea is the same.
  374.  
  375.     A program called "ren" that does this job nicely was posted
  376.     to comp.sources.unix some time ago.  It lets you use
  377.  
  378.         ren '*.foo' '#1.bar'
  379.  
  380.     Shell loops like the above can also be used to translate
  381.     file names from upper to lower case or vice versa.  You could use
  382.     something like this to rename uppercase files to lowercase:
  383.  
  384.         C Shell:
  385.             foreach f ( * )
  386.                 mv $f ¢echo $f | tr '[A-Z]' '[a-z]'¢
  387.             end
  388.         Bourne Shell:
  389.             for f in *; do
  390.                 mv $f ¢echo $f | tr '[A-Z]' '[a-z]'¢
  391.             done
  392.  
  393.     If you wanted to be really thorough and handle files with
  394.     ¢funny' names (embedded blanks or whatever) you'd need to use
  395.  
  396.         Bourne Shell:
  397.  
  398.             for f in *; do
  399.                 eval mv '"$f"' ╪"¢echo "$f" | tr '[A-Z]' '[a-z]'¢╪"
  400.             done
  401. 9't.  It happens
  402.      to be harmless to include them in this particular example; versions of
  403.      tr that don't want the [] will conveniently think they are supposed
  404.      to translate '[' to '[' and ']' to ']').
  405.  
  406.     If you have the "perl" language installed, you may find this rename
  407.     script by Larry Wall very useful.  It can be used to accomplish a
  408.     wide variety of filename changes.
  409.  
  410.         #!/usr/bin/perl
  411.         #
  412.         # rename script examples from lwall:
  413.         #       rename 's/╪.orig$//' *.orig
  414.         #       rename 'y/A-Z/a-z/ unless /^Make/' *
  415.         #       rename '$_ .= ".bad"' *.f
  416.         #       rename 'print "$_: "; s/foo/bar/ if <stdin> =─ /^y/i' *
  417.  
  418.         $op = shift;
  419.         for (@ARGV) ñ
  420.             $was = $_;
  421.             eval $op;
  422.             die $@ if $@;
  423.             rename($was,$_) unless $was eq $_;
  424.         ç
  425.  
  426.  
  427. 10) Why do I get [some strange error message] when I "rsh host command" ?
  428.  
  429.     (We're talking about the remote shell program "rsh" or sometimes "remsh";
  430.      on some machines, there is a restricted shell called "rsh", which
  431.      is a different thing.)
  432.  
  433.     If your remote account uses the C shell, the remote host will
  434.     fire up a C shell to execute 'command' for you, and that shell
  435.     will read your remote .cshrc file.  Perhaps your .cshrc contains
  436.     a "stty", "biff" or some other command that isn't appropriate
  437.     for a non-interactive shell.  The unexpected output or error
  438.     message from these commands can screw up your rsh in odd ways.
  439.  
  440.     Fortunately, the fix is simple.  There are, quite possibly, a whole
  441.     *bunch* of operations in your ".cshrc" (e.g., "set history=N") that are
  442.     simply not worth doing except in interactive shells.  What you do is
  443.     surround them in your ".cshrc" with:
  444.  
  445.             if ( $?prompt ) then
  446.                     operations....
  447.             endif
  448.  
  449.     and, since in a non-interactive shell "prompt" won't be set, the
  450.     operations in question will only be done in interactive shells.
  451.  
  452.     You may also wish to move some commands to your .login file; if
  453.     those commands only need to be done when a login session starts up
  454.     (checking for new mail, unread news and so on) it's better
  455.     to have them in the .login file.
  456.  
  457. 11) How do I find out the creation time of a file?
  458.  
  459.     You can't - it isn't stored anywhere.  Files have a last-modified
  460.     time (shown by "ls -l"), a last-accessed time (shown by "ls -lu")
  461.     and an inode change time (shown by "ls -lc"). The latter is often
  462.     referred to as the "creation time" - even in some man pages -  but
  463.     that's wrong; it's the time the file's status was last changed,
  464.     either by writing or changing the inode (via mv or chmod, etc...).
  465.  
  466.     The man page for "stat(2)" discusses this.
  467.  
  468. 12) How do I use "rsh" without having the rsh hang around until the
  469.     remote command has completed?
  470.  
  471.     (See note in question 10 about what "rsh" we're talking about.)
  472.  
  473.     The obvious answers fail:
  474.                 rsh machine command &
  475.     or      rsh machine 'command &'
  476.  
  477.     For instance, try doing   rsh machine 'sleep 60 &'
  478.     and you'll see that the 'rsh' won't exit right away.
  479.     It will wait 60 seconds until the remote 'sleep' command
  480.     finishes, even though that command was started in the
  481.     background on the remote machine.  So how do you get
  482.     the 'rsh' to exit immediately after the 'sleep' is started?
  483.  
  484.     The solution - if you use csh on the remote machine:
  485.  
  486.             rsh machine -n 'command >&/dev/null </dev/null &'
  487.  
  488.     If you use sh on the remote machine:
  489.  
  490.             rsh machine -n 'command >/dev/null 2>&1 </dev/null &'
  491.  
  492.     Why?  "-n" attaches rsh's stdin to /dev/null so you could run the
  493.     complete rsh command in the background on the LOCAL machine.
  494.     Thus "-n" is equivalent to another specific "< /dev/null".
  495.     Furthermore, the input/output redirections on the REMOTE machine
  496.     (inside the single quotes) ensure that rsh thinks the session can
  497.     be terminated (there's no data flow any more.)
  498.  
  499.     Note: on the remote machine, you needn't redirect to/from
  500.     /dev/null; any ordinary file will do.
  501.  
  502.     In many cases, various parts of these complicated commands
  503.     aren't necessary.
  504.  
  505. 13) How do I truncate a file?
  506.  
  507.     The BSD function ftruncate() sets the length of a file.  Xenix -
  508.     and therefore SysV r3.2 and later - has the chsize() system call.
  509.     For other systems, the only kind of truncation you can do is
  510.     truncation to length zero with creat() or open(..., O_TRUNC).
  511.  
  512. 14) How do I ñset an environment variable, change directoryç inside a
  513.         shell script and have that change affect my current shell?
  514.  
  515.     You can't, unless you use a special command to run the script in
  516.     the context of the current shell rather than in a child program.
  517.     The process environment (including environment variables and
  518.     current directory) is inherited by child programs but cannot be
  519.     passed back to parent programs.
  520.  
  521.     For instance, if you have a C shell script named "myscript":
  522.  
  523.         cd /very/long/path
  524.         setenv PATH /something:/something-else
  525.  
  526.     or the equivalent Bourne or Korn shell script
  527.  
  528.         cd /very/long/path
  529.         PATH=/something:/something-else export PATH
  530.  
  531.     and try to run "myscript" from your shell, your shell will fork and run
  532.     the shell script in a subprocess.  The subprocess is also
  533.     running the shell; when it sees the "cd" command it changes
  534.     *its* current directory, and when it sees the "setenv" command
  535.     it changes *its* environment, but neither has any effect on the current
  536.     directory of the shell at which you're typing (your login shell,
  537.     let's say).
  538.  
  539.     In order to get your login shell to execute the script (without forking)
  540.     you have to use the "." command (for the Bourne or Korn shells)
  541.     or the "source" command (for the C shell).  I.e. you type
  542.  
  543.         . myscript
  544.  
  545.     to the Bourne or Korn shells, or
  546.  
  547.         source myscript
  548.  
  549.     to the C shell.
  550.  
  551.     If all you are trying to do is change directory or set an
  552.     environment variable, it will probably be simpler to use a
  553.     C shell alias or Bourne/Korn shell function.  See the "how do
  554.     I get the current directory into my prompt" section
  555.     of this article for some examples.
  556.  
  557. 15) Why doesn't find's "ñç" symbol do what I want?
  558.  
  559.     "find" has a -exec option that will execute a particular
  560.     command on all the selected files. Find will replace any "ñç"
  561.     it sees with the name of the file currently under consideration.
  562.  
  563.     So, some day you might try to use "find" to run a command on every
  564.     file, one directory at a time.  You might try this:
  565.  
  566.         find /path -type d -exec command ñç/╪* ╪;
  567.  
  568.     hoping that find will execute, in turn
  569.  
  570.         command directory1/*
  571.         command directory2/*
  572.         ...
  573.  
  574.     Unfortunately, find only expands the "ñç" token when it appears
  575.     by itself.  Find will leave anything else like "ñç/*" alone, so
  576.     instead of doing what you want, it will do
  577.  
  578.         command ñç/*
  579.         command ñç/*
  580.         ...
  581.  
  582.     once for each directory.  This might be a bug, it might be a feature
  583.     but we're stuck with the current behaviour.
  584.  
  585.     So how do you get around this?  One way would be to write a
  586.     trivial little shell script, let's say "./doit", that
  587.     consists of
  588.  
  589.         command "$1"/*
  590.  
  591.     You could then use
  592.  
  593.         find /path -type d -exec ./doit ñç ╪;
  594.  
  595.     Or if you want to avoid the "./doit" shell script, you can use
  596.  
  597.         find /path -type d -exec sh -c 'command $0/*' ñç ╪;
  598.  
  599.     (This works because within the 'command' of "sh -c 'command' A B C ...",
  600.      $0 expands to A, $1 to B, and so on.)
  601.  
  602.  
  603.     If all you're trying to do is cut down on the number of times
  604.     that "command" is executed, you should see if your system
  605.     has the "xargs" command.  Xargs reads arguments one line at a time
  606.     from the standard input and assembles as many of them as will fit into
  607.     one command line.  You could use
  608.  
  609.         find /path -print | xargs command
  610.  
  611.     which would result in
  612.  
  613.         command file1 file2 file3 file4 dir1/file1 dir1/file2
  614.  
  615.  
  616.     Unfortunately this is not a perfectly robust or secure solution.
  617.     Xargs expects its input lines to be terminated with newlines, so it
  618.     will be confused by files with odd characters such as newlines
  619.     in their names.
  620.  
  621.  
  622. 16) How do I redirect stdout and stderr separately in csh?
  623.  
  624.     In csh, you can redirect stdout with ">", or stdout and stderr
  625.     together with ">&" but there is no direct way to redirect
  626.     stderr only.  The best you can do is
  627.  
  628.         ( command >stdout_file ) >&stderr_file
  629.  
  630.     which runs "command" in a subshell;  stdout is redirected inside
  631.     the subshell to stdout_file, and both stdout and stderr from the
  632.     subshell are redirected to stderr_file, but by this point stdout
  633.     has already been redirected so only stderr actually winds up in
  634.     stderr_file.
  635.  
  636.     Sometimes it's easier to let sh do the work for you.
  637.  
  638.         sh -c 'command >stdout_file 2>stderr_file'
  639.  
  640. 17) How do I set the permissions on a symbolic link?
  641.  
  642.     Permissions on a symbolic link don't really mean anything.  The
  643.     only permissions that count are the permissions on the file that
  644.     the link points to.
  645.  
  646. 18) When someone refers to 'rn(1)' or 'ctime(3)', what does
  647.     the number in parentheses mean?
  648.  
  649.     It looks like some sort of function call, but it isn't.
  650.     These numbers refer to the section of the "Unix manual" where
  651.     the appropriate documentation can be found.  You could type
  652.     "man 3 ctime" to look up the manual page for "ctime" in section 3
  653.     of the manual.
  654.  
  655.     The standard manual sections are:
  656.  
  657.         1        User-level  commands
  658.         2        System calls
  659.         3        Library functions
  660.         4        Devices and device drivers
  661.         5        File formats
  662.         6        Games
  663.         7        Various miscellaneous stuff - macro packages etc.
  664.         8        System maintenance and operation commands
  665.  
  666.  
  667.     Some Unix versions use non-numeric section names.  For instance,
  668.     Xenix uses "C" for commands and "S" for functions.
  669.  
  670.     Each section has an introduction, which you can read with "man # intro"
  671.     where # is the section number.
  672.  
  673.     Sometimes the number is necessary to differentiate between a
  674.     command and a library routine or system call of the same name.  For
  675.     instance, your system may have "time(1)", a manual page about the
  676.     'time' command for timing programs, and also "time(3)", a manual
  677.     page about the 'time' subroutine for determining the current time.
  678.     You can use "man 1 time" or "man 3 time" to specify which "time"
  679.     man page you're interested in.
  680.  
  681.     You'll often find other sections for local programs or
  682.     even subsections of the sections above - Ultrix has
  683.     sections 3m, 3n, 3x and 3yp among others.
  684.  
  685.  
  686. 19) What does ñawk,grep,fgrep,egrep,biff,cat,gecos,nroff,troff,tee,bssç
  687.     stand for?
  688.  
  689.     awk = "Aho Weinberger and Kernighan"
  690.  
  691.         This language was named by its authors, Al Aho, Peter Weinberger and
  692.         Brian Kernighan.
  693.  
  694.     grep = "Global Regular Expression Print"
  695.  
  696.         grep comes from the ed command to print all lines matching a
  697.         certain pattern
  698.  
  699.                     g/re/p
  700.  
  701.         where "re" is a "regular expression".
  702.  
  703.     fgrep = "Fixed Grep".
  704.  
  705.         fgrep searches for fixed strings only.  The "f" does not
  706.         stand for "fast" - in fact, "fgrep foobar *.c" is usually slower
  707.         than "egrep foobar *.c"  (yes, this is kind of surprising. Try it.)
  708.  
  709.         Fgrep still has its uses though, and may be useful when searching
  710.         a file for a larger number of strings than egrep can handle.
  711.  
  712.     egrep = "Extended Grep"
  713.  
  714.         egrep uses fancier regular expressions than grep.
  715.         Many people use egrep all the time, since it has some more
  716.         sophisticated internal algorithms than grep or fgrep,
  717.         and is usually the fastest of the three programs.
  718.  
  719.     cat = "catenate"
  720.  
  721.         catenate is an obscure word meaning "to connect in a series",
  722.         which is what the "cat" command does to one or more files.
  723.         Not to be confused with C/A/T, the Computer Aided Typesetter.
  724.  
  725.     gecos = "General Electric Comprehensive Operating System"
  726.  
  727.         When GE's large systems division was sold to Honeywell,
  728.         Honeywell dropped the "E" from "GECOS".
  729.  
  730.         Unix's password file has a "pw_gecos" field.  The name is
  731.         a real holdover from the early days.  Dennis Ritchie
  732.         has reported:
  733.  
  734.             "Sometimes we sent printer output or batch jobs
  735.              to the GCOS machine.  The gcos field in the
  736.              password file was a place to stash the information
  737.              for the $IDENT card.  Not elegant."
  738.  
  739.     nroff = "New ROFF"
  740.     troff = "Typesetter ROFF"
  741.  
  742.         These are descendants of "roff", which was a re-implementation
  743.         of the Multics "runoff" program.
  744.  
  745.     tee        = T
  746.  
  747.         From plumbing terminology for a T-shaped pipe splitter.
  748.  
  749.     bss = "Block Started by Symbol"
  750.  
  751.         Dennis Ritchie says:
  752.  
  753.             Actually the acronym (in the sense we took it up; it may
  754.             have other credible etymologies) is "Block Started by Symbol."
  755.             It was a pseudo-op in FAP (Fortran Assembly [-er?] Program), an
  756.             assembler for the IBM 704-709-7090-7094 machines.  It defined
  757.             its label and set aside space for a given number of words.
  758.             There was another pseudo-op, BES, "Block Ended by Symbol"
  759.             that did the same except that the label was defined by
  760.             the last assigned word + 1.  (On these machines Fortran
  761.             arrays were stored backwards in storage and were 1-origin.)
  762.  
  763.             The usage is reasonably appropriate, because just as with
  764.             standard Unix loaders, the space assigned didn't have to
  765.             be punched literally into the object deck but was represented
  766.             by a count somewhere.
  767.  
  768.     biff = "biff"
  769.  
  770.             This command, which turns on asynchronous mail notification,
  771.         was actually named after a dog at Berkeley.
  772.  
  773.             I can confirm the origin of biff, if you're interested.  Biff
  774.             was Heidi Stettner's dog, back when Heidi (and I, and Bill Joy)
  775.             were all grad students at U.C. Berkeley and the early versions
  776.             of BSD were being developed.   Biff was popular among the
  777.             residents of Evans Hall, and was known for barking at the
  778.             mailman, hence the name of the command.
  779.  
  780.         Confirmation courtesy of Eric Cooper, Carnegie Mellon
  781.         University
  782.  
  783.     Don Libes' book "Life with Unix" contains lots more of these
  784.     tidbits.
  785.  
  786.  
  787. 20) How does the gateway between "comp.unix.questions" and the
  788.     "info-unix" mailing list work?
  789.  
  790.     "Info-Unix" and "Unix-Wizards" are mailing list versions of
  791.     comp.unix.questions and comp.unix.wizards respectively.
  792.     There should be no difference in content between the
  793.     mailing list and the newsgroup.
  794.  
  795.     To get on or off either of these lists, send mail to
  796.     Info-Unix-Request@brl.mil or Unix-Wizards-Request@brl.mil .
  797.     Be sure to use the '-Request'.  Don't expect an immediate response.
  798.  
  799.     Here are the gory details, courtesy of the list's maintainer, Bob Reschly.
  800.  
  801.     ==== postings to info-UNIX and UNIX-wizards lists ====
  802.  
  803.        Anything submitted to the list is posted; I do not moderate incoming
  804.     traffic -- BRL functions as a reflector.  Postings submitted by Internet
  805.     subscribers should be addressed to the list address (info-UNIX or UNIX-
  806.     wizards);  the '-request' addresses are for correspondence with the list
  807.     maintainer [me].  Postings submitted by USENET readers should be
  808.     addressed to the appropriate news group (comp.unix.questions or
  809.     comp.unix.wizards).
  810.  
  811.        For Internet subscribers, received traffic will be of two types;
  812.     individual messages, and digests.  Traffic which comes to BRL from the
  813.     Internet and BITNET (via the BITNET-Internet gateway) is immediately
  814.     resent to all addressees on the mailing list.  Traffic originating on
  815.     USENET is gathered up into digests which are sent to all list members
  816.     daily.
  817.  
  818.        BITNET traffic is much like Internet traffic.  The main difference is
  819.     that I maintain only one address for traffic destined to all BITNET
  820.     subscribers. That address points to a list exploder which then sends
  821.     copies to individual BITNET subscribers.  This way only one copy of a
  822.     given message has to cross the BITNET-Internet gateway in either
  823.     direction.
  824.  
  825.        USENET subscribers see only individual messages.  All messages
  826.     originating on the Internet side are forwarded to our USENET machine.
  827.     They are then posted to the appropriate newsgroup.  Unfortunately,
  828.     for gatewayed messages, the sender becomes "news@brl-adm".  This is
  829.     currently an unavoidable side-effect of the software which performs the
  830.     gateway function.
  831.  
  832.        As for readership, USENET has an extremely large readership - I would
  833.     guess several thousand hosts and tens of thousands of readers.  The
  834.     master list maintained here at BRL runs about two hundred fifty entries
  835.     with roughly ten percent of those being local redistribution lists.
  836.     I don't have a good feel for the size of the BITNET redistribution, but
  837.     I would guess it is roughly the same size and composition as the master
  838.     list.  Traffic runs 150K to 400K bytes per list per week on average.
  839.  
  840. 21) How do I pronounce "vi" , or "!", or "/*", or ...?
  841.     You can start a very long and pointless discussion by wondering
  842.     about this topic on the net.  Some people say "vye", some say
  843.     "vee-eye" (the vi manual suggests this) and some Roman numerologists
  844.     say "six".  How you pronounce "vi" has nothing to do with whether
  845.     or not you are a true Unix wizard.
  846.  
  847.     Similarly, you'll find that some people pronounce "char" as "care",
  848.     and that there are lots of ways to say "#" or "/*" or "!" or
  849.     "tty" or "/etc".  No one pronunciation is correct - enjoy the regional
  850.     dialects and accents.
  851.  
  852.     Since this topic keeps coming up on the net, here is a comprehensive
  853.     pronunciation list that has made the rounds in the past.  This list
  854.     is maintained by Maarten Litmaath, maart@cs.vu.nl .
  855.  
  856. Names derived from UNIX are marked with *, names derived from C are marked
  857. with +, names derived from (Net)Hack are marked with & and names deserving
  858. futher explanation are marked with a #.  The explanations will be given at
  859. the very end.
  860.  
  861. ------------------------------------------------------------------------------
  862.                            -- SINGLE CHARACTERS --
  863.  
  864.      SPACE, blank, ghost&
  865.  
  866. !    EXCLAMATION POINT, exclamation (mark), (ex)clam, excl, wow, hey, boing,
  867.         bang#, shout, yell, shriek, pling, factorial, ball-bat, smash, cuss,
  868.         store#, potion&, not*+, dammit*#
  869.  
  870. "    QUOTATION MARK, (double) quote, dirk, literal mark, rabbit ears,
  871.         double ping, double glitch, amulet&, web&, inverted commas
  872.  
  873. #    CROSSHATCH, pound, pound sign, number, number sign, sharp, octothorpe#,
  874.         hash, fence, crunch, mesh, hex, flash, grid, pig-pen, tictactoe,
  875.         scratch (mark), (garden)gate, hak, oof, rake, sink&, corridor&,
  876.         unequal#
  877.  
  878. $    DOLLAR SIGN, dollar, cash, currency symbol, buck, string#, escape#,
  879.         ding, big-money, gold&
  880.  
  881. %    PERCENT SIGN, percent, mod+, shift-5, double-oh-seven, grapes, food&
  882.  
  883. &    AMPERSAND, and, amper, address+, shift-7, andpersand, snowman,
  884.         bitand+, donald duck#, daemon&, background*
  885.  
  886. '    APOSTROPHE, (single) quote, tick, prime, irk, pop, spark, glitch,
  887.         lurker above&
  888.  
  889. *    ASTERISK, star, splat, spider, aster, times, wildcard*, gear, dingle,
  890.         (Nathan) Hale#, bug, gem&, twinkle, funny button#, pine cone, glob*
  891.  
  892. ()   PARENTHESES, parens, round brackets, bananas, ears, bowlegs
  893. (    LEFT PARENTHESIS,  (open) paren,  so,  wane,  parenthesee,   open,  sad,
  894.         tool&
  895. )    RIGHT PARENTHESIS, already, wax, unparenthesee, close (paren), happy,
  896.         thesis, weapon&
  897.  
  898. +    PLUS SIGN, plus, add, cross, and, intersection, door&, spellbook&
  899.  
  900. ,    COMMA, tail, trapper&
  901.  
  902. -    HYPHEN, minus (sign), dash, dak, option, flag, negative (sign), worm,
  903.         bithorpe#
  904.  
  905. .    PERIOD, dot, decimal (point), (radix) point, spot, full stop,
  906.         put#, floor&
  907.  
  908. /    SLASH, stroke, virgule, solidus, slant, diagonal, over, slat, slak,
  909.         across#, compress#, reduce#, replicate#, spare, divided-by, wand&,
  910.         forward slash
  911.  
  912. :    COLON, two-spot, double dot, dots, chameleon&
  913.  
  914. ;    SEMICOLON, semi, hybrid, giant eel&, go-on#
  915.  
  916. <>   ANGLE BRACKETS, angles, funnels, brokets, pointy brackets
  917. <    LESS THAN,    less, read from*, from*,        in*,  comesfrom*, crunch,
  918.         sucks, left chevron#, open pointy (brack[et]), bra#, upstairs&, west
  919. >    GREATER THAN, more, write to*,  into/toward*, out*, gazinta*,   zap,
  920.         blows, right chevron#, closing pointy (brack[et]), ket#, downstairs&,
  921.         east
  922.  
  923. =    EQUAL SIGN, equal(s), gets, becomes, quadrathorpe#, half-mesh, ring&
  924.  
  925. ?    QUESTION MARK, question, query, whatmark, what, wildchar*, huh, ques,
  926.         kwes, quiz, quark, hook, scroll&
  927.  
  928. @    AT SIGN, at, each, vortex, whirl, whirlpool, cyclone, snail, ape, cat,
  929.         snable-a#, trunk-a#, rose, cabbage, Mercantile symbol, strudel#,
  930.         fetch#, shopkeeper&, human&, commercial-at
  931.  
  932. []   BRACKETS, square brackets, U-turns, edged parentheses
  933. [    LEFT BRACKET,  bracket,   bra, (left) square (brack[et]),   opensquare,
  934.         armor&
  935. ]    RIGHT BRACKET, unbracket, ket, right square (brack[et]), unsquare, close,
  936.         mimic&
  937.  
  938. ╪    BACKSLASH, reversed virgule, bash, (back)slant, backwhack, backslat,
  939.         escape*, backslak, bak, scan#, expand#, opulent throne&, slosh, slope,
  940.         blash
  941.  
  942. ^    CIRCUMFLEX, caret, carrot, (top)hat, cap, uphat, party hat, housetop,
  943.         up arrow, control, boink, chevron, hiccup, power, to-the(-power), fang,
  944.         sharkfin, and#, xor+, wok, trap&, pointer#, pipe*, upper-than#
  945.  
  946. _    UNDERSCORE, underline, underbar, under, score, backarrow, flatworm, blank,
  947.         chain&, gets#, dash#
  948.  
  949. ¢    GRAVE, (grave/acute) accent, backquote, left/open quote, backprime,
  950.         unapostrophe, backspark, birk, blugle, backtick, push, backglitch,
  951.         backping, execute#, boulder&, rock&
  952.  
  953. ñç   BRACES, curly braces, squiggly braces, curly brackets, squiggle brackets,
  954.         Tuborgs#, ponds, curly chevrons#, squirrly braces, hitchcocks#,
  955.         chippendale brackets#
  956. ñ    LEFT BRACE,  brace,   curly,   leftit, embrace,  openbrace, begin+,
  957.         fountain&
  958. ç    RIGHT BRACE, unbrace, uncurly, rytit,  bracelet, close,     end+, a pool&
  959.  
  960. |    VERTICAL BAR, pipe*, pipe to*, vertical line, broken line#, bar, or+,
  961.         bitor+, vert, v-bar, spike, to*, gazinta*, thru*, pipesinta*, tube,
  962.         mark, whack, gutter, wall&
  963.  
  964. ─    TILDE, twiddle, tilda, tildee, wave, squiggle, swung dash, approx,
  965.         wiggle, enyay#, home*, worm, not+
  966.  
  967.  
  968.                         -- MULTIPLE CHARACTER STRINGS --
  969.  
  970. !?        interrobang (one overlapped character)
  971. */        asterslash+, times-div#
  972. /*           slashterix+, slashaster
  973. :=        becomes#
  974. <-        gets
  975. <<        left-shift+, double smaller
  976. <>        unequal#
  977. >>        appends*, cat-astrophe, right-shift+, double greater
  978. ->        arrow+, pointer to+, hiccup+
  979. #!        sh'bang, wallop
  980. ╪!*        bash-bang-splat
  981. ()        nil#
  982. &&        and+, and-and+, amper-amper, succeeds-then*
  983. ||        or+, or-or+, fails-then*
  984.  
  985.  
  986.                                 -- NOTES --
  987.  
  988. ! bang                comes from old card punch phenom where punching ! code mad
  989. e a
  990.                 loud noise; however, this pronunciation is used in the (non-
  991.                 computerized) publishing and typesetting industry in the U.S.
  992.                 too, so ...
  993. ! store                from FORTH
  994. ! dammit        as in "quit, dammit!" while exiting vi and hoping one hasn't
  995.                 clobbered a file too badly
  996. # octothorpe        from Bell System (orig. octalthorpe)
  997. # unequal        e.g. Modula-2
  998. $ string        from BASIC
  999. $ escape        from TOPS-10
  1000. & donald duck        from the Danish "Anders And", which means "Donald Duck"
  1001. * splat                from DEC "spider" glyph
  1002. * Nathan Hale        "I have but one asterisk for my country."
  1003. * funny button        at Pacific Bell, * was referred to by employees as the "fu
  1004. nny
  1005.                 button", which did not please management at all when it became
  1006.                 part of the corporate logo of Pacific Telesis, the holding
  1007.                 company ...
  1008. */ times-div        from FORTH
  1009. = quadrathorpe        half an octothorpe
  1010. - bithorpe        half a quadrathorpe (So what's a monothorpe?)
  1011. . put                Victor Borge's Phonetic Punctuation which dates back to th
  1012.                 middle 1950's
  1013. / across        APL
  1014. / compress        APL
  1015. / reduce        APL
  1016. / replicate        APL
  1017. := becomes        e.g. Pascal
  1018. ; go-on                Algol68
  1019. < left chevron        from the military: worn vertically on the sleeve to signif
  1020. y
  1021.                 rating
  1022. < bra                from quantum mechanics
  1023. <> unequal        e.g. Pascal
  1024. > right chevron        see "< left chevron"
  1025. > ket                from quantum mechanics
  1026. @ snable-a        from Danish; may translate as "trunk-a"
  1027. @ trunk-a        "trunk" = "elephant nose"
  1028. @ strudel        as in Austrian apple cake
  1029. @ fetch                from FORTH
  1030. ╪ scan                APL
  1031. ╪ expand        APL
  1032. ^ and                from formal logic
  1033. ^ pointer        from PASCAL
  1034. ^ upper-than        cf. > and <
  1035. _ gets                some alternative representation of underscore resembles a
  1036.                 backarrow
  1037. _ dash                as distinct from '-' == minus
  1038. ¢ execute        from shell command substitution
  1039. ñç Tuborgs        from advertizing for well-known Danish beverage
  1040. ñç curly chevr.        see "< left chevron"
  1041. ñç hitchcocks        from the old Alfred Hitchcock show, with the stylized profi
  1042. le
  1043.                 of the man
  1044. ñç chipp. br.        after Chippendale chairs
  1045. | broken line        EBCDIC has two vertical bars, one solid and one broken.
  1046. ─ enyay                from the Spanish n-tilde
  1047. () nil                LISP
  1048. --
  1049. -JUDGE DREDD/NIA
  1050.  
  1051. [OTHER WORLD BBS]
  1052.  
  1053.  
  1054.  
  1055.  
  1056. Downloaded From P-80 International Information Systems 304-744-2253 12yrs+
  1057.